package com.soen6441.generics;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

class Subtyping {
    public static void main(String[] args) {
        List stuff = new ArrayList();
        stuff.add("Troy");
        // java autoboxes primitives
        // into their object counter parts
        stuff.add(Integer.valueOf(1));

        Iterator it = stuff.iterator();
        while( it.hasNext() ) {
            // gives class cast exception
            // when gets to the integer
            String s = (String)it.next();
            System.out.println(s.contains("r"));
        }
    }
}
